<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="46">
  <CheatEntries>
    <CheatEntry>
      <ID>30</ID>
      <Description>"载入程序"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{$lua}
if syntaxcheck then return end

-- 定义目标进程
local targetProcess = "Happy Island Fantasy.exe"

[ENABLE]
-- 检查进程是否存在
if getProcessIDFromProcessName(targetProcess) == nil then
    showMessage('请先启动 ' .. targetProcess .. ' 然后再激活此脚本。')
    return -- 停止执行脚本
else
    -- 进程存在，尝试附加
    openProcess(targetProcess)
    sleep(500) -- 等待一段时间让附加操作完成
end

-- 检查是否成功附加到进程
if getProcessIDFromProcessName(targetProcess) ~= getOpenedProcessID() then
    showMessage('附加到 ' .. targetProcess .. ' 失败，请检查进程权限。')
    return
end

function cycleFullCompact(sender,force)
  local state = not(compactmenuitem.Caption == '简易视图')
  if force~=nil then state = not force end
  compactmenuitem.Caption = state and '简易视图' or '全屏视图'
  getMainForm().Splitter1.Visible = state
  getMainForm().Panel4.Visible = state
  getMainForm().Panel5.Visible = state
end

function addCompactMenu()
  if compactmenualreadyexists then return end
  local parent = getMainForm().Menu.Items
  compactmenuitem = createMenuItem(parent)
  parent.add(compactmenuitem)
  compactmenuitem.Caption = '简易视图'
  compactmenuitem.OnClick = cycleFullCompact
  compactmenualreadyexists = 'yes'

  -- 添加一个分隔符
  local separator = createMenuItem(parent)
  separator.Caption = '-'
  parent.add(separator)
end

-- 添加菜单项
addCompactMenu()
cycleFullCompact()

-- 尝试启用Mono功能（如果游戏是基于Mono的，如Unity）
if not monopipe then
    if LaunchMonoDataCollector() == 0 then
        showMessage('启动失败，请游戏和CE修改器重启试试，再有问题可以在Q群里问')
    end
end

[DISABLE]
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>31</ID>
      <Description>"体力和背包物品不能一起开，只能同时开一个"</Description>
      <Color>0000FF</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
    <CheatEntry>
      <ID>4</ID>
      <Description>"体力(esc键刷新地址)"</Description>
      <Options moHideChildren="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : Happy Island Fantasy.exe
  Version: 
  Date   : 2025-09-25
  Author : B站  鸣叶月
  UID：510138740
  QQ群：1063450709
}

[ENABLE]

aobscan(INJECT,10 48 63 08 89 4D E0) // should be unique
alloc(newmem,$1000,INJECT)
alloc(TiLi,8)
registersymbol(TiLi)
label(code)
label(return)

newmem:
  cmp [rsp+20],2
  jne code

  mov [TiLi],rax
code:
  movsxd  rcx,dword ptr [rax]
  mov [rbp-20],ecx
  jmp return

INJECT+01:
  jmp newmem
  nop
return:
registersymbol(INJECT)

[DISABLE]

INJECT+01:
  db 48 63 08 89 4D E0

unregistersymbol(INJECT)
dealloc(newmem)
dealloc(TiLi)
unregistersymbol(TiLi)
{
// ORIGINAL CODE - INJECTION POINT: System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+65

System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+3e: 85 C0                          - test eax,eax
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+40: 0F 8C 31 00 00 00              - jl System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+77
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+46: 48 8B 47 18                    - mov rax,[rdi+18]
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+4a: 49 63 CF                       - movsxd  rcx,r15d
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+4d: 39 48 18                       - cmp [rax+18],ecx
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+50: 0F 86 67 00 00 00              - jbe System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+bd
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+56: 48 6B C9 18                    - imul rcx,rcx,18
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+5a: 48 03 C1                       - add rax,rcx
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+5d: 48 83 C0 20                    - add rax,20
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+61: 48 83 C0 10                    - add rax,10
// ---------- INJECTING HERE ----------
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+65: 48 63 08                       - movsxd  rcx,dword ptr [rax]
// ---------- DONE INJECTING  ----------
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+68: 89 4D E0                       - mov [rbp-20],ecx
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+6b: 48 63 40 04                    - movsxd  rax,dword ptr [rax+04]
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+6f: 89 45 E4                       - mov [rbp-1C],eax
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+72: E9 30 00 00 00                 - jmp System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+a7
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+77: 48 8B CE                       - mov rcx,rsi
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+7a: 48 8D 6D 00                    - lea rbp,[rbp+00]
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+7e: 49 BB 39 3C 92 49 43 01 00 00  - mov r11,0000014349923C39
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+88: 41 FF D3                       - call r11
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+8b: C7 45 D8 00 00 00 00           - mov [rbp-28],00000000
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:get_Item+92: C7 45 DC 00 00 00 00           - mov [rbp-24],00000000
}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>5</ID>
          <Description>"锁定67936"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>TiLi</Address>
          <Offsets>
            <Offset>0</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>6</ID>
          <Description>"锁定57694"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>TiLi</Address>
          <Offsets>
            <Offset>4</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>27</ID>
      <Description>"(有bug，不建议使用！)背包物品数量4460"</Description>
      <Color>000000</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : Happy Island Fantasy.exe
  Version: 
  Date   : 2025-09-25
  Author : B站  鸣叶月
  UID：510138740
  QQ群：1063450709
}

[ENABLE]

aobscan(INJECT,48 63 08 89 4D E0 48 63 40 04 89 45 E4 E9) // should be unique
alloc(newmem,$1000,INJECT)

label(code)
label(return)

newmem:
  cmp [rsp+70],0
  jne code

  mov rsp,[rsp+10]
  cmp [rsp+20],0
  jne code

  mov [rax],#64104
  mov [rax+04],#37446


code:
  movsxd  rcx,dword ptr [rax]
  mov [rbp-20],ecx
  movsxd  rax,dword ptr [rax+04]
  mov [rbp-1C],eax
  jmp return

INJECT:
  jmp newmem
  nop 8
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 48 63 08 89 4D E0 48 63 40 04 89 45 E4

unregistersymbol(INJECT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: 2662771D185

2662771D15E: 85 C0                          - test eax,eax
2662771D160: 0F 8C 31 00 00 00              - jl 2662771D197
2662771D166: 48 8B 47 18                    - mov rax,[rdi+18]
2662771D16A: 49 63 CF                       - movsxd  rcx,r15d
2662771D16D: 39 48 18                       - cmp [rax+18],ecx
2662771D170: 0F 86 67 00 00 00              - jbe 2662771D1DD
2662771D176: 48 6B C9 18                    - imul rcx,rcx,18
2662771D17A: 48 03 C1                       - add rax,rcx
2662771D17D: 48 83 C0 20                    - add rax,20
2662771D181: 48 83 C0 10                    - add rax,10
// ---------- INJECTING HERE ----------
2662771D185: 48 63 08                       - movsxd  rcx,dword ptr [rax]
// ---------- DONE INJECTING  ----------
2662771D188: 89 4D E0                       - mov [rbp-20],ecx
2662771D18B: 48 63 40 04                    - movsxd  rax,dword ptr [rax+04]
2662771D18F: 89 45 E4                       - mov [rbp-1C],eax
2662771D192: E9 30 00 00 00                 - jmp 2662771D1C7
2662771D197: 48 8B CE                       - mov rcx,rsi
2662771D19A: 48 8D 6D 00                    - lea rbp,[rbp+00]
2662771D19E: 49 BB 09 3D F6 FA 65 02 00 00  - mov r11,00000265FAF63D09
2662771D1A8: 41 FF D3                       - call r11
2662771D1AB: C7 45 D8 00 00 00 00           - mov [rbp-28],00000000
2662771D1B2: C7 45 DC 00 00 00 00           - mov [rbp-24],00000000
}
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>29</ID>
      <Description>"金钱自己去商店卖，记得物品最好留几个，然后在刷"</Description>
      <Color>0000FF</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
    <CheatEntry>
      <ID>40</ID>
      <Description>"刷物品数量记得备份！！"</Description>
      <Color>0000FF</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
    <CheatEntry>
      <ID>35</ID>
      <Description>"物品数量地址"</Description>
      <Options moHideChildren="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : Happy Island Fantasy.exe
  Version: 
  Date   : 2025-09-27
  Author : ����

  This script does blah blah blah
}

[ENABLE]
aobscan(INJECT,89 48 04 B8 01 00 00 00 E9 D9) // should be unique
alloc(newmem,$1000,INJECT)
alloc(WuPin,8)
registersymbol(WuPin)
label(code)
label(return)

newmem:
  mov [WuPin],rax
code:
  mov [rax+04],ecx
  mov eax,00000001
  jmp return

INJECT:
  jmp newmem
  nop 3
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 89 48 04 B8 01 00 00 00

unregistersymbol(INJECT)
dealloc(newmem)
dealloc(WuPin)
unregistersymbol(WuPin)
{
// ORIGINAL CODE - INJECTION POINT: System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3f1

System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3c6: 48 6B C8 18           - imul rcx,rax,18
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3ca: 49 8B C6              - mov rax,r14
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3cd: 48 03 C1              - add rax,rcx
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3d0: 48 83 C0 20           - add rax,20
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3d4: 48 85 C0              - test rax,rax
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3d7: 0F 84 3F 04 00 00     - je System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+81c
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3dd: 48 83 C0 10           - add rax,10
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3e1: 48 63 8D 58 FF FF FF  - movsxd  rcx,dword ptr [rbp-000000A8]
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3e8: 89 08                 - mov [rax],ecx
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3ea: 48 63 8D 5C FF FF FF  - movsxd  rcx,dword ptr [rbp-000000A4]
// ---------- INJECTING HERE ----------
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3f1: 89 48 04              - mov [rax+04],ecx
// ---------- DONE INJECTING  ----------
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3f4: B8 01 00 00 00        - mov eax,00000001
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3f9: E9 D9 02 00 00        - jmp System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+6d7
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+3fe: 0F B6 85 50 FF FF FF  - movzx eax,byte ptr [rbp-000000B0]
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+405: 83 F8 02              - cmp eax,02
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+408: 0F 84 22 03 00 00     - je System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+730
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+40e: 33 C0                 - xor eax,eax
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+410: E9 C2 02 00 00        - jmp System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+6d7
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+415: 48 63 C6              - movsxd  rax,esi
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+418: 41 39 46 18           - cmp [r14+18],eax
System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+41c: 0F 86 F3 03 00 00     - jbe System.Collections.Generic.Dictionary`2[System.String,TE.TEInt]:TryInsert+815
}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>38</ID>
          <Description>"物品数量变动时，刷新数值，获取对应物品地址"</Description>
          <Color>0000FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>39</ID>
          <Description>"物品为0时购买时，地址错误，再买一次正常"</Description>
          <Color>0000FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>41</ID>
          <Description>"两个数值都要改，不然物品会消失"</Description>
          <Color>0080FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>36</ID>
          <Description>"4460数量对应37446"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>WuPin</Address>
          <Offsets>
            <Offset>4</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>37</ID>
          <Description>"4460数量对应64104"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>WuPin</Address>
          <Offsets>
            <Offset>0</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <Structures StructVersion="2">
    <Structure Name="Entry[]" AutoFill="0" AutoCreate="1" DefaultHex="0" AutoDestroy="1" DoNotSaveLocal="1" RLECompression="1" AutoCreateStructsize="4096">
      <Elements>
        <Element Offset="24" Vartype="4 Bytes" Bytesize="4" OffsetHex="00000018" Description="Count" DisplayMethod="unsigned integer"/>
        <Element Offset="32" Vartype="Pointer" Bytesize="8" OffsetHex="00000020" Description="[0]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="56" Vartype="Pointer" Bytesize="8" OffsetHex="00000038" Description="[1]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="80" Vartype="Pointer" Bytesize="8" OffsetHex="00000050" Description="[2]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="104" Vartype="Pointer" Bytesize="8" OffsetHex="00000068" Description="[3]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="128" Vartype="Pointer" Bytesize="8" OffsetHex="00000080" Description="[4]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="152" Vartype="Pointer" Bytesize="8" OffsetHex="00000098" Description="[5]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="176" Vartype="Pointer" Bytesize="8" OffsetHex="000000B0" Description="[6]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="200" Vartype="Pointer" Bytesize="8" OffsetHex="000000C8" Description="[7]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="224" Vartype="Pointer" Bytesize="8" OffsetHex="000000E0" Description="[8]Entry" DisplayMethod="unsigned integer"/>
        <Element Offset="248" Vartype="Pointer" Bytesize="8" OffsetHex="000000F8" Description="[9]Entry" DisplayMethod="unsigned integer"/>
      </Elements>
    </Structure>
  </Structures>
</CheatTable>
